import { BaseEntity } from '../../base/entity/base';
import { Column, Entity, Index } from 'typeorm';

/**
 * 文章信息
 */
@Entity('article_content')
export class ArticleContentEntity extends BaseEntity {
  @Index()
  @Column({ comment: '标题', length: 255 })
  title: string;

  @Column({ comment: '内容', type: 'text' })
  content: string;

  @Index()
  @Column({ comment: '分类ID' })
  categoryId: number;

  @Column({ comment: '状态', dict: ['草稿', '发布', '下架'], default: 0 })
  status: number;

  @Column({ comment: '排序值', default: 0 })
  orderValue: number;

  @Column({ comment: '作者', length: 50, nullable: true })
  author: string;

  @Column({ comment: '来源', length: 100, nullable: true })
  source: string;

  @Column({ comment: '封面图', length: 255, nullable: true })
  coverImage: string;

  @Column({ comment: '摘要', type: 'text', nullable: true })
  summary: string;

  @Column({ comment: '标签', type: 'json', nullable: true })
  tags: string[];

  @Column({ comment: '发布时间', type: 'varchar', nullable: true })
  publishTime: Date;

  @Column({ comment: '浏览量', default: 0 })
  views: number;

  @Column({ comment: '点赞数', default: 0 })
  likes: number;

  @Column({ comment: '收藏数', default: 0 })
  favorites: number;
}
